home *** CD-ROM | disk | FTP | other *** search
/ LOGIC 2000 February / LogicCd--feb.2000-mac-cdr.iso / Apple II / II.SOUND.V4.2 / IISOUND.DOCS < prev    next >
Text File  |  1994-12-06  |  16KB  |  186 lines

  1. !========================================!
  2. !                                        !
  3. !         IISound.System v4.2            !
  4. !                                        !
  5. !Digital Sound playback for the Apple IIe!
  6. !      ][+ version coming soon!!         !
  7. !========================================!
  8. !    By Philip Lamb : ShareWare 1994     !
  9. !========================================!
  10.  
  11. Playback engine by Michael Mahon : Freeware 1992
  12. File selection dialogue by Karl Bunker
  13. Inspired by "SoftDAC" by Scott Alfter : Freeware 1992
  14.  
  15. This program is Shareware. Registration costs $15 US/$20 NZ and the more people register, the more likely I am to continue adding enhancements (like IBM .wav and Audio IFF readers!). Please distribute it as widely as possible, but make sure that these docs are with the program, intact and unchanged!
  16.  
  17. Contents
  18. 1) Intro to sound on the Apple ][
  19. 2) The IISound package
  20. 3) Program operation
  21. 4) Sound sources
  22. 5) Extra memory
  23. 6) Ramdisks
  24. 7) Shell programs
  25. 8) How the playback code works
  26. 9) Shareware notice
  27. 10) Registration info!
  28.  11) Contacts.
  29. 12) Registration form
  30.  
  31. INTRO TO SOUND ON THE APPLE ][
  32. Despite all its other great properties, the Apple ][ has always had serious limitations in recording and reproducing audio.  These limits were repeatedly tested by talented programmers such as Paul Lutus, who in 1981 wrote Electric Duet, which produced real two-voice, reedy music!  A host of other programs used similar techniques during the 80's, but the fundamental (harmonic?) tyranny of square waves continued.
  33. Then, in 1990, Scott Alfter wrote a little suite of programs to play Mac sound files on any Apple ][. Scott's IISound represented a new high water mark for audio reproduction on a non-GS Apple ][.  It played 11 kHz. sampled sound files through the Apple speaker (or the cassette output) with reasonable fidelity--not great, still gravelly, but much better than had ever been heard before. It apparently inspired Michael Mahon to discover just how far you could go in making a vanilla Apple ][ sound like a IIGS or a Mac WITHOUT adding any hardware.  His five bit playback engine, as appears in the program SOUND.EDITOR was the result.
  34.  
  35. THE IISOUND PACKAGE
  36. The plyback engine in IISound works in substantially the same manner as Michael's, with only minor modification. Around this playback engine, I built a fully operational and user friendly system program, to handle sound loading and
  37. playback. Editing and saving features are being worked on right now, and should be out soon (if lotsa people register!)
  38.  
  39. This distribution includes these files:
  40. IISound.System    The biggie. Requires an Apple IIe with 128K or more memory.
  41. IISound.Mini      A cut down version, for use only by shell programs.
  42. IISound.Docs      You're reading em right now!
  43. IISound.Welcome   A sample digitised sound to whet your appetite
  44.  
  45. I am now readying, for version 5.0 of IISound:
  46. IISound.64K       A version which runs in 64K, and requires only a ][+
  47. IISound.Editor    A plug in, fully featured DHR sound editor and saver.
  48. IISound.Player    A Basic.System added cmd to play sound files from BASIC
  49.  
  50.  
  51. PROGRAM OPERATION
  52. The program is menu driven, including disk loads and saves (thank you Karl
  53. Bunker), and fairly self explanatory.
  54.  
  55. Loading sounds:
  56. Up to 15 sounds can be loaded at once, but this is of course limited by the amount of memory that you have.
  57. [L] loads a standard sound file.
  58. [;] loads a sound file, but discards every 2nd byte, thus, 22.050 kHz sounds will load as though they are 11.025 kHz sounds (playback is still at 11.000 kHz though)
  59. ['] as above , except discards 3/4 bytes, thus allowing 44.1 kHz compact disk sounds to be played.
  60. (I am currently working on a modification to allow sounds of any frequency to be loaded and standardised to 11kHz. When this is done, then Audio IFF/
  61. true .wav readers will appear!)
  62. A file selection dialogue box appears. As of version 4.2, IISound loads all sounds as raw sound data, thus the data headers on some sounds (eg the 64 byte header on $D8 (SND) type files) will also play, as noisy clicks. This problem will be removed (hopefully!) in v5.0 when it will identify and read Audio IFF & IBM .wav sounds and Mac sounds from a mac resource file (transferred using A2FX.)
  63.  
  64. Playback!
  65. On the right side of the screen appears a list of the sounds currently loaded in memory. Each sound can be cued for instant playback just by pressing the key or the letter that appears beside the sound name. While one sound is playing, you can press a key for another sound to be played, and it will play immediately after the first has played.
  66.  
  67. Unloading Sounds:
  68. Pressing [X] from the main menu will allow you to clear a sound from memory. You will be prompted to press the key corresponding to the sound you wish to clear. Clearing a sound causes all the sounds above it in memory (below it on the menu) to be shuffled down to consolidate memory. With several sounds loaded, this can take some time so be patient! Clearing the most recently loaded sound will be instant though.
  69.  
  70. Other keys:
  71. [T] Toggles between speaker/cassette output.
  72. [Q] Quits IISound
  73. [R] reinits memory, clearing the current sound.
  74. [Ctrl-D] shows some low level info on the sound in memory.
  75. [>] and [<] switch between the two menus of keys.
  76.  
  77.  
  78. SOUND SOURCES
  79. Unfortunately, you can't (yet!) digitize sounds with much precision on an unaided Apple ][, but there are a wealth of 8-bit digitized sounds available in the IIGS, Mac and IBM worlds, and many can be easily downloaded from online services. On Internet, the USENET News groups alt.binaries.sounds.* carry thousands of megabytes of sounds. Many are in IBM .wav format which will usually play just fine. The FAQ for these groups will give you more info on how to decode them.
  80.  
  81.  
  82. EXTRA MEMORY
  83. IISound will identify and attempt to use all available memory on Ramworks type auxiliary slot memory cards. Because of the awkward nature of Apple II memory, and timing constraints, the program utilises only 46K of each 64K bank. With a standard 128K IIe, you'll get around 4.5 seconds playback. With a 1 meg ramcard though, you can have over 1 minute of sound. With the largest ramworks around (3 meg) you can have over 3.5 minutes of sound!
  84.  
  85.  
  86. RAMDISKS
  87. Upon startup, the program looks for any Ramdisk that may be using aux. mem. and it will graciously remove any slot 3 drive 2 ramdisk that you might have installed, whether it is the 64K volume created by ProDOS or the larger volume created by Applied Engineering's ProDrive software. If the ramdisk conatins files you will be given options of quitting (without touching /RAM), using only the first 64K of aux. mem. (thus skirting around ramdisks which leave this bank free) or removing the ramdisk.
  88.  
  89.  
  90. SHELL PROGRAMS
  91. IISound supports the Apple system program auto-run protocol, that is, it allows a file to be specified upon launching which will be automatically loaded into memory and played, finally returning control back to the launcher (through the ProDOS quit code). Either a partial or full pathname should be stored in memory before control is passed to IISound. The maximum length of the path is at $2005 (8197) in memory after IISound has been loaded. The length of the name should be stored at $2006 (8198) and the path in standard ascii immediately after. This function can be carried out nicely by "shells" like Davex, ECP-8 etc. Here is a sample invocation that works on ECP-8 or  Davex shells:
  92.             IISound.System /lambo/sound/welcome.raw
  93. This starts up IISound and plays the file /lambo/sound/welcome.raw.  You don't have to specify a full pathname for the sound file; IISound will accept partial pathnames.  If an invalid pathname is specified, IISound will return to your shell.  If a valid pathname is given, IISound will load the sound, play it, and return to your shell. The shell feature works on both IISound.System and IISound.Mini, which will ONLY work through use of a shell utility, and which will only load 11kHz files.
  94.  
  95.  
  96. HOW THE PLAYBACK CODE WORKS
  97. It takes several bits of precision in converting digital samples to sound to make "good" sound, but the natural audio output capability of the Apple speaker (prior to the IIGS) is only one bit.  You can decide when to "toggle" the speaker, but that's it--the cone is either all the way in (or headed there) or all the way out (or headed there).  Experiments have shown that the human ear is essentially insensitive to the "polarity" of sound, so "in" and "out" can be interchanged in all the discussion that follows.  (This is just as well, since the Apple I/O circuitry doesn't give us control over the polarity anyway!)
  98.  
  99. Paul Lutus (and others) found that greater resolution in speaker movement could be achieved by toggling the speaker (in and out) at a high frequency, and then varying the "duty cycle" of the square wave. Changing the duty cycle (the fraction of the time the speaker is commanded to be "in," say) of a high frequency square wave can be thought of as causing the speaker cone to move to a position approximating the average value of the square wave, which is the duty cycle.  This allows us to generate multiple tones by changing the duty cycle at an audio rate to approximate the value of the sum of the two (or more) tones.
  100.  
  101. This latest DAC code has a long and distinguished pedigree. From Paul Lutus original work, to Scott Alfter's 3 bit, and later 4 bit playback code, to Michael Mahon's 5 bit engine, it has become cleaner, and crisper. Then with help from Greg Templeman, Michael completely rewrote his 5 bit code, to eliminate the 11KHz carrier (an annoying screech over the playback) that had previously limited the usefulness of any further improvements. His DAC522 code is the result, and is the playback engine (modified for use of auxiliary memory by me) used in IISound v4.2
  102.  
  103. As most sounds are sampled at multiples of 11.025 kHz, this is the most logical playback speed. Thus on an unaccelerated II, of clock speed 1.023 MHz we have 1023000 / 11025 = 93 cycles to playback each sample twice ( for 2* oversampling.) This latest DAC is composed of 16 different pulse generators, each of which has the job of producing two identical pulses with "on" times varying from 6 to 37 machine cycles and with a constant period of 46 cycles. The total period of the two pulses is 92 cycles, the closest even approximation to 11.025 kHz.  (Actually, 11.092 kHz.) At the end of each generator, it jumps to the generator needed for the next sound sample.  It's only coincidental if it winds up "looping" by vectoring to itself!
  104.  
  105. The appropriate generator is selected by the most significant 4 bits of the sound sample, and the fifth-most significant bit is used to lengthen the duty cycle by 1 cycle, if it is set.  As a result, this software DAC, aptly named DAC522, converts with a precision of 5 bits and a "carrier" frequency of 22.05 kHz.
  106.  
  107. The average noise from 5 bit/ 2* oversampled playback is about 1.5%. The result, I think you'll agree, is excellent audio reproduction, out the standard ][ speaker. I listen to my Apple //e through a large amp and the output of this 5-bit software DAC is good enough to mimic a IIGS or a Mac, ! You can also use the cassette output (except on //c's) to listen, or record onto tape.
  108.  
  109.  
  110. NOTICE
  111. This program is SHAREWARE.  This means that you can freely distribute it any way you like as long as you don't  remove this notice, but if you use it regularly, you are expected to register the software (see instuctions below) With the tiny amount of new software being written for the II, registration is especially important. Positive reinforcement does work! The more people register, the more time I will put into making this software comparable to programs on bigger platforms. I can do this. Time is the onlny limiting factor, and registration helps offset this. I would ask that you do not distribute modified versions of this software, but send any ideas or code for modifications to me, and I will include them in my releases. This way the software won't diverge into mediocrity.
  112.  
  113. Now for the important bit!
  114.  
  115. REGISTRATION
  116. To assist me in making better versions of this software, please fill out the registration form below. If you include an Internet email address I will acknowledge the receipt of your form by email as soon as I recieve it. Registration, apart from giving me positive reinforcement that people want and use my software, entitles you to discounts of registration of future versions at minimal cost, so please take the time to fill this out and send it to me, along with the fee of $15 US/$20 NZ. Postage from the US costs only $0.90 so there isn't much of a premium! Please include any comments you would like to make, features you would like to see, bugs you have found, and what you like to use IISound to do. Thanks again!
  117.  
  118. To register your copy of IISound v4.2 please send $15 US or $20 NZ to;
  119.                  Mail:   Philip R. Lamb
  120.                          30a Blighs Rd
  121.                          Christchurch 8005
  122.                          New Zealand
  123.                  Email:  p.lamb@csc.canterbury.ac.nz
  124.                  Finger: misc176@cantva.canterbury.ac.nz
  125. These addresses are likely to remain valid until at least 1997 and probably after that too!
  126.  
  127. Other contacts:
  128.  
  129. Michael Mahon                      Scott Alfter
  130. 1975 Adele Place                   Skunk Works Software Co.
  131. San Jose, CA 95125                 4600 Swenson St. #163A
  132. USA                                Las Vegas, NV 89119
  133. Internet: mahon@nsa.hp.com         USA
  134.  
  135.  
  136. ~~~~~~~~~~~~~~~~~~~~~~~~~IISound v4.2 Registration Form~~~~~~~~~~~~~~~~~~
  137.  
  138. To register you copy of IISound v4.2 please send $15 US or $20 NZ to;
  139.                          Philip R. Lamb
  140.                          30a Blighs Rd
  141.                          Christchurch 8005
  142.                          New Zealand
  143.  
  144. Name:____________________________________________________________________
  145.  
  146. Street:__________________________________________________________________
  147.  
  148. City:______________________________ State: ______________________________
  149.  
  150. Country:_________________________________ Zip Code:______________________
  151.  
  152. Email address:___________________________________________________________
  153.  
  154. Where did you obtain your copy of IISound v4.2?
  155.      ____ Friend
  156.      ____ User Group
  157.      ____ Usenet News (comp.binaries.apple2)
  158.      ____ Internet FTP site (Please specify: ____________________________
  159.  
  160. CPU: ____ Apple ][ or ][+
  161.      ____ Apple //e (unenhanced)
  162.      ____ Apple //e (enhanced)
  163.      ____ Apple IIc or IIc+
  164.      ____ Apple IIGS
  165.      ____ Apple Emulator (Please specify: _______________________________
  166.  
  167. Comments:________________________________________________________________
  168. _________________________________________________________________________
  169. _________________________________________________________________________
  170. _________________________________________________________________________
  171. _________________________________________________________________________
  172. _________________________________________________________________________
  173. _________________________________________________________________________
  174. _________________________________________________________________________
  175. _________________________________________________________________________
  176.  
  177. Bugs encountered:________________________________________________________
  178. _________________________________________________________________________
  179. _________________________________________________________________________
  180. _________________________________________________________________________
  181. _________________________________________________________________________
  182. _________________________________________________________________________
  183. _________________________________________________________________________
  184. _________________________________________________________________________
  185. _________________________________________________________________________
  186.